{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	s:string;
	bc, nc :char;
	i:integer;
	count:integer=0;
begin
	readln(s);
	nc:=' ';
	bc:=' ';
	for i:=1 to length(s) do
	begin
		bc:=nc;
		nc:=s[i];
		if(bc=' ') and (nc<>' ') then
		 inc(count);
	end;
	writeln(count);
end.
